<template>
  <div id="ContactUs" class="contact-page">
    <!-- 页面头部 -->
    <div class="contact-hero">
      <div class="hero-content">
        <div class="hero-badge">
          <span class="badge-text">联系我们</span>
        </div>
        <h1 class="hero-title">让我们开始对话</h1>
        <p class="hero-subtitle">无论是咨询服务、技术支持还是商务合作，我们都期待与您取得联系</p>
      </div>
    </div>

    <!-- 联系方式快速导航 -->
    <div class="quick-contact">
      <div class="quick-contact-container">
        <div class="quick-contact-grid">
          <div class="quick-item wow fadeInUp" data-wow-delay="0.1s">
            <div class="quick-icon">
              <i class="glyphicon glyphicon-earphone"></i>
            </div>
            <h4>电话咨询</h4>
            <p>15328965713</p>
            <span class="quick-desc">工作日 9:00-18:00</span>
          </div>
          
          <div class="quick-item wow fadeInUp" data-wow-delay="0.2s">
            <div class="quick-icon">
              <i class="glyphicon glyphicon-envelope"></i>
            </div>
            <h4>邮件联系</h4>
            <p>1437594522@qq.com</p>
            <span class="quick-desc">24小时内回复</span>
          </div>
          
          <div class="quick-item wow fadeInUp" data-wow-delay="0.3s">
            <div class="quick-icon">
              <i class="glyphicon glyphicon-comment"></i>
            </div>
            <h4>在线客服</h4>
            <p>即时响应</p>
            <span class="quick-desc">专业技术支持</span>
          </div>
          
          <div class="quick-item wow fadeInUp" data-wow-delay="0.4s">
            <div class="quick-icon">
              <i class="glyphicon glyphicon-map-marker"></i>
            </div>
            <h4>公司地址</h4>
            <p>浙江省杭州市拱墅区</p>
            <span class="quick-desc">欢迎实地参观</span>
          </div>
        </div>
      </div>
    </div>

    <!-- 主要内容区域 -->
    <div class="contact-main">
      <div class="contact-container">
        <div class="contact-grid">
          <!-- 联系表单 -->
          <div class="contact-form-section">
            <div class="form-header wow fadeInUp">
              <h2>发送消息</h2>
              <p>填写下面的表单，我们会尽快与您联系</p>
            </div>
            
            <form class="contact-form wow fadeInUp" @submit.prevent="submitForm">
              <div class="form-row">
                <div class="form-group">
                  <label for="name">姓名 *</label>
                  <input 
                    type="text" 
                    id="name" 
                    v-model="formData.name"
                    required
                    placeholder="请输入您的姓名"
                  />
                </div>
                <div class="form-group">
                  <label for="company">公司</label>
                  <input 
                    type="text" 
                    id="company" 
                    v-model="formData.company"
                    placeholder="请输入公司名称"
                  />
                </div>
              </div>
              
              <div class="form-row">
                <div class="form-group">
                  <label for="email">邮箱 *</label>
                  <input 
                    type="email" 
                    id="email" 
                    v-model="formData.email"
                    required
                    placeholder="请输入您的邮箱"
                  />
                </div>
                <div class="form-group">
                  <label for="phone">电话</label>
                  <input 
                    type="tel" 
                    id="phone" 
                    v-model="formData.phone"
                    placeholder="请输入您的电话"
                  />
                </div>
              </div>
              
              <div class="form-group">
                <label for="subject">主题 *</label>
                <select id="subject" v-model="formData.subject" required>
                  <option value="">请选择咨询主题</option>
                  <option value="product">产品咨询</option>
                  <option value="technical">技术支持</option>
                  <option value="business">商务合作</option>
                  <option value="career">招聘咨询</option>
                  <option value="other">其他</option>
                </select>
              </div>
              
              <div class="form-group">
                <label for="message">详细内容 *</label>
                <textarea 
                  id="message" 
                  v-model="formData.message"
                  required
                  rows="6"
                  placeholder="请详细描述您的需求或问题"
                ></textarea>
              </div>
              
              <div class="form-actions">
                <button type="submit" class="btn-submit" :disabled="isSubmitting">
                  {{ isSubmitting ? '发送中...' : '发送消息' }}
                </button>
              </div>
            </form>
          </div>
          
          <!-- 联系信息 -->
          <div class="contact-info-section">
            <div class="info-header wow fadeInUp">
              <h2>联系信息</h2>
              <p>多种方式与我们取得联系</p>
            </div>
            
            <div class="contact-info-list">
              <div class="info-item wow fadeInUp" data-wow-delay="0.1s">
                <div class="info-icon">
                  <i class="glyphicon glyphicon-map-marker"></i>
                </div>
                <div class="info-content">
                  <h4>公司地址</h4>
                  <p>浙江省杭州市拱墅区<br>万家花城8憧</p>
                  <span class="info-note">工作日开放参观</span>
                </div>
              </div>
              
              <div class="info-item wow fadeInUp" data-wow-delay="0.2s">
                <div class="info-icon">
                  <i class="glyphicon glyphicon-earphone"></i>
                </div>
                <div class="info-content">
                  <h4>联系电话</h4>
                  <p>15328965713</p>
                  <span class="info-note">周一至周五 9:00-18:00</span>
                </div>
              </div>
              
              <div class="info-item wow fadeInUp" data-wow-delay="0.3s">
                <div class="info-icon">
                  <i class="glyphicon glyphicon-envelope"></i>
                </div>
                <div class="info-content">
                  <h4>邮箱地址</h4>
                  <p>1437594522@qq.com</p>
                  <span class="info-note">24小时内回复</span>
                </div>
              </div>
              
              <div class="info-item wow fadeInUp" data-wow-delay="0.4s">
                <div class="info-icon">
                  <i class="glyphicon glyphicon-time"></i>
                </div>
                <div class="info-content">
                  <h4>工作时间</h4>
                  <p>周一至周五 9:00-18:00<br>周六 9:00-17:00</p>
                  <span class="info-note">节假日可预约</span>
                </div>
              </div>
            </div>
            
            <!-- 社交媒体 -->
            <div class="social-links wow fadeInUp" data-wow-delay="0.5s">
              <h4>关注我们</h4>
              <div class="social-grid">
                <a href="#" class="social-item">
                  <div class="social-icon wechat">
                    <i class="glyphicon glyphicon-comment"></i>
                  </div>
                  <span>微信</span>
                </a>
                <a href="#" class="social-item">
                  <div class="social-icon weibo">
                    <i class="glyphicon glyphicon-flash"></i>
                  </div>
                  <span>微博</span>
                </a>
                <a href="#" class="social-item">
                  <div class="social-icon linkedin">
                    <i class="glyphicon glyphicon-user"></i>
                  </div>
                  <span>LinkedIn</span>
                </a>
                <a href="#" class="social-item">
                  <div class="social-icon github">
                    <i class="glyphicon glyphicon-hdd"></i>
                  </div>
                  <span>GitHub</span>
                </a>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 成功提示弹窗 -->
    <div v-if="showSuccessModal" class="success-modal" @click="closeSuccessModal">
      <div class="modal-content" @click.stop>
        <div class="success-icon">
          <i class="glyphicon glyphicon-ok-circle"></i>
        </div>
        <h3>消息发送成功！</h3>
        <p>感谢您的联系，我们会在24小时内回复您。</p>
        <button class="btn-close" @click="closeSuccessModal">确定</button>
      </div>
    </div>
  </div>
</template>

<script setup name="ContactUs">
import WOW from 'wow.js'
import { onMounted, ref, reactive } from 'vue'

// 表单数据
const formData = reactive({
  name: '',
  company: '',
  email: '',
  phone: '',
  subject: '',
  message: ''
})

// 提交状态
const isSubmitting = ref(false)
const showSuccessModal = ref(false)

// 表单提交
async function submitForm() {
  isSubmitting.value = true
  
  try {
    // 模拟提交过程
    await new Promise(resolve => setTimeout(resolve, 1500))
    
    // 重置表单
    Object.keys(formData).forEach(key => {
      formData[key] = ''
    })
    
    // 显示成功提示
    showSuccessModal.value = true
  } catch (error) {
    alert('发送失败，请稍后重试')
  } finally {
    isSubmitting.value = false
  }
}

// 关闭成功弹窗
function closeSuccessModal() {
  showSuccessModal.value = false
}

onMounted(() => {
  const wow = new WOW({
    boxClass: 'wow',
    animateClass: 'animated',
    offset: 0,
    mobile: true,
    live: true
  })
  wow.init()
})
</script>

<style scoped>
/* 苹果风格联系我们页面 */
.contact-page {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
  background: #ffffff;
  color: #1d1d1f;
}

/* 页面头部 */
.contact-hero {
  padding: 120px 0 80px;
  background: linear-gradient(135deg, #f5f5f7 0%, #ffffff 100%);
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.hero-badge {
  margin-bottom: 24px;
}

.badge-text {
  display: inline-block;
  background: rgba(0, 113, 227, 0.08);
  color: #0071e3;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}

.hero-title {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 24px 0;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.hero-subtitle {
  font-size: 21px;
  font-weight: 400;
  color: #86868b;
  margin: 0;
  line-height: 1.38;
  max-width: 600px;
  margin: 0 auto;
}

/* 快速联系 */
.quick-contact {
  padding: 80px 0;
  background: #f5f5f7;
}

.quick-contact-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.quick-contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 32px;
}

.quick-item {
  background: #ffffff;
  border-radius: 18px;
  padding: 32px 24px;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}

.quick-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(0, 113, 227, 0.02) 0%, rgba(0, 113, 227, 0.06) 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.quick-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 113, 227, 0.1);
}

.quick-item:hover::before {
  opacity: 1;
}

.quick-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #0071e3 0%, #005bb5 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.quick-icon i {
  font-size: 28px;
  color: #ffffff;
}

.quick-item h4 {
  font-size: 20px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}

.quick-item p {
  font-size: 18px;
  font-weight: 500;
  color: #0071e3;
  margin: 0 0 8px 0;
  position: relative;
  z-index: 1;
}

.quick-desc {
  font-size: 14px;
  color: #86868b;
  position: relative;
  z-index: 1;
}

/* 主要内容区域 */
.contact-main {
  padding: 120px 0;
  background: #ffffff;
}

.contact-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 80px;
  align-items: start;
}

/* 表单部分 */
.form-header {
  margin-bottom: 40px;
}

.form-header h2 {
  font-size: 32px;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 16px 0;
  letter-spacing: -0.02em;
}

.form-header p {
  font-size: 19px;
  color: #86868b;
  margin: 0;
  line-height: 1.42;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 16px;
  font-weight: 500;
  color: #1d1d1f;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 16px 20px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  background: #ffffff;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #0071e3;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 16px;
}

.btn-submit {
  background: #0071e3;
  color: #ffffff;
  border: none;
  border-radius: 980px;
  padding: 16px 48px;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 180px;
}

.btn-submit:hover:not(:disabled) {
  background: #0077ed;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 113, 227, 0.4);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 联系信息部分 */
.info-header {
  margin-bottom: 40px;
}

.info-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 16px 0;
  letter-spacing: -0.02em;
}

.info-header p {
  font-size: 17px;
  color: #86868b;
  margin: 0;
  line-height: 1.47;
}

.contact-info-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 48px;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 24px;
  background: #f5f5f7;
  border-radius: 16px;
  transition: all 0.3s ease;
}

.info-item:hover {
  background: #ffffff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.info-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #0071e3 0%, #005bb5 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.info-icon i {
  font-size: 24px;
  color: #ffffff;
}

.info-content h4 {
  font-size: 18px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
}

.info-content p {
  font-size: 16px;
  color: #515154;
  margin: 0 0 8px 0;
  line-height: 1.5;
}

.info-note {
  font-size: 14px;
  color: #86868b;
}

/* 社交媒体 */
.social-links h4 {
  font-size: 20px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 20px 0;
  letter-spacing: -0.01em;
}

.social-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.social-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #f5f5f7;
  border-radius: 12px;
  text-decoration: none;
  color: #1d1d1f;
  transition: all 0.3s ease;
}

.social-item:hover {
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
  text-decoration: none;
  color: #1d1d1f;
}

.social-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-icon.wechat {
  background: linear-gradient(135deg, #07c160, #00b04f);
}

.social-icon.weibo {
  background: linear-gradient(135deg, #e6162d, #c4101b);
}

.social-icon.linkedin {
  background: linear-gradient(135deg, #0077b5, #005885);
}

.social-icon.github {
  background: linear-gradient(135deg, #333, #24292e);
}

.social-icon i {
  font-size: 16px;
  color: #ffffff;
}

.social-item span {
  font-size: 14px;
  font-weight: 500;
}

/* 成功弹窗 */
.success-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.success-modal .modal-content {
  background: #ffffff;
  border-radius: 20px;
  padding: 48px 32px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, #34c759, #30d158);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-icon i {
  font-size: 40px;
  color: #ffffff;
}

.success-modal h3 {
  font-size: 24px;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 16px 0;
  letter-spacing: -0.01em;
}

.success-modal p {
  font-size: 17px;
  color: #86868b;
  margin: 0 0 32px 0;
  line-height: 1.47;
}

.btn-close {
  background: #34c759;
  color: #ffffff;
  border: none;
  border-radius: 980px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-close:hover {
  background: #30d158;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .contact-hero {
    padding: 80px 0 60px;
  }

  .hero-content {
    padding: 0 16px;
  }

  .quick-contact {
    padding: 60px 0;
  }

  .quick-contact-container {
    padding: 0 16px;
  }

  .quick-contact-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
  }

  .quick-item {
    padding: 24px 20px;
  }

  .contact-main {
    padding: 80px 0;
  }

  .contact-container {
    padding: 0 16px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 60px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 14px 16px;
  }

  .btn-submit {
    width: 100%;
    padding: 16px 24px;
  }

  .social-grid {
    grid-template-columns: 1fr;
  }

  .success-modal .modal-content {
    padding: 32px 24px;
    margin: 20px;
  }
}
</style>